package com.icloud.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.Gravity;
import android.widget.EditText;

import com.icloud.main.Font;
import com.icloud.main.R;

public class ExtendedEditText extends EditText {
	private Context context;
	private String label = "ndluc";
    private int width;
    private int height;
	public ExtendedEditText(Context context) {
		super(context);
		init(context);
	}
	
	public ExtendedEditText(Context context, AttributeSet attrs) {
		super(context, attrs);
		init(context);
	}

	public ExtendedEditText(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		init(context);
	}
	
	private void init(Context context){
		this.context = context;
		setTypeface(Font.ROBOTO_REGULAR);
		setTextSize(context.getResources().getDimension(R.dimen.subhead));
		setGravity(Gravity.CENTER_VERTICAL);
		int padding = (int)context.getResources().getDimension(R.dimen.extended_edittext_top_bottom_padding);
		setPadding(getPaddingLeft(), padding, getPaddingRight(), padding);
		setBackgroundDrawable(context.getResources().getDrawable(R.drawable.divider_extended_edittext));
	}
	
	@Override
    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        height = (int)context.getResources().getDimension(R.dimen.extended_edittext_height);
        width = this.getMeasuredWidth();
        
        setMeasuredDimension(width, height);
    }
}
